package jupitermouse.site.juc.demo.aqs.condition;

import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

/**
 * <p>
 *     Condition使用
 * </p>
 *
 * @author jupiter
 */
public class App {

    public static void main(String[] args) {
        // 现在有一把锁
        Lock lock = new ReentrantLock();
        // synchronized  wait ---- notify
        // 基于这把锁产生了一个 condition: 作用是对于这把锁的 唤醒 和 等待操作
        Condition condition = lock.newCondition();

        new Thread(new ConditionWait(lock, condition)).start();
        new Thread(new ConditionNotify(lock, condition)).start();

    }
}
